<?php

namespace App\Models;

use Illuminate\Database\Eloquent\Model;

/**
 * @property int $id
 * @property int $user_id
 * @property string $openid
 * @property string $nickname
 * @property int $sex
 * @property string $language
 * @property string $city
 * @property string $province
 * @property string $country
 * @property string $avatar
 * @property User $user
 */
class WeChatUser extends Model
{
    /**
     * {@inheritdoc}
     */
    protected $table = 'wechat_users';

    /**
     * {@inheritdoc}
     */
    public $timestamps = false;

    /**
     * {@inheritdoc}
     */
    protected $fillable = [
        'openid',
        'nickname',
        'sex',
        'language',
        'city',
        'province',
        'country',
        'avatar',
    ];

    /**
     * 用户
     *
     * @return \Illuminate\Database\Eloquent\Relations\HasOne
     */
    public function User()
    {
        return $this->hasOne(User::class, 'user_id');
    }
}
